<!DOCTYPE HTML >
<html>
<head>
    <script src="js/history.min.js?redirect=true&basepath=history.test1.ru/"></script>
    <script src="js/jquery.min.js"></script>
    <title>тест тест</title>
    <meta charset="utf-8" />
</head>
<body>
    <a title="страничка 0" href="ajax_0.php">страничка 0</a>
    <a title="страничка 1" href="ajax_1.php">страничка 1</a>
    <a title="страничка 2" href="ajax_2.php">страничка 2</a>
    <a title="страничка 3" href="ajax_3.php">страничка 3</a>
    <a title="страничка 4" href="ajax_4.php">страничка 4</a>
    <a title="страничка 5" href="ajax_5.php">страничка 5</a>
    <a title="страничка 6" href="ajax_6.php">страничка 6</a>
    <br /><br />
    <div id="container" style="width:700px; background: #CCCDE1;height: 400px; overflow-y: scroll;">
        bjksdfnsjkdb nkkflsdjflkjsdfsdjfsdfsdfosd
    </div>
<pre>
$.ajax({
    type: "POST",
    url: $(a.target).attr('action'),
    data: data,
    beforeSend : function(xhr) {
        return xhr.setRequestHeader('X-PJAX','true'); // IMPORTANT
    },
    success: function(msg){
    cont.html(msg);
        $('#loading-shade').hide();
    },
    error: function(a,b,c) {
        $('#loading-shade').hide();
    }
});
</pre>
<script>
    $('a').click(function(a){
        var state = {
            title: this.getAttribute( "title" ),
            url: this.getAttribute( "href", 2 ) // двоечка нужна для ИЕ6-7
        };
        history.pushState( state, state.title, state.url );
        $.ajax({
            url:a.target.href,
            beforeSend : function(xhr) {
                return xhr.setRequestHeader('MY_AJAX_REQUEST','true'); // IMPORTANT
            },
            success: function(msg)
            {
                $('title').html(state.title);
                $('#container').html(msg);
            }
        });
        return false; 
    });
    $(window).bind('popstate',function(e) {
        $.ajax({
            url: history.location,
            beforeSend : function(xhr) {
                return xhr.setRequestHeader('MY_AJAX_REQUEST','true'); // IMPORTANT
            },
            success: function(msg){
                $('#container').html(msg);
                $('title').html(e.state.title);
            }
        });
        //return false;
    });
</script>

</body>
</html>
